package com.ihome.excel.xlsx.engine.export.testing;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.ihome.excel.xlsx.engine.export.AbstractExcelExportEngine;
import com.ihome.excel.xlsx.test.entity.Customer;

public class CustomerExportHandler extends AbstractExcelExportEngine {

	@Override
	public int rowsTotalCount() {
		return 1000000;
	}

	@Override
	public int rowsBatchCount() {
		return 250000;
	}

	@Override
	public List rowsCollection(int currentLoopIndex) {
		List<Customer> cusList = new ArrayList<Customer>();
		Customer cu = new Customer();
		if(currentLoopIndex == 1) {
			for(int i = 1 ; i <= 250000 ; i ++) {
				cu.setAge(i);
				cu.setHeight(18.11);
				cu.setAmount(new BigDecimal(3330.12));
				cu.setBirthDay(new Date());
				cu.setEmail("xxx@hubei.com");
				cu.setName("小明");
				cu.setSeatPhoneNumber("07558978009");
				cu.setAddress("深圳市龙华新区街道办");
				cu.setCardNo("897777");
				cu.setTelephoneNumber("13913910989");
				cusList.add(cu);
			}
		}else if(currentLoopIndex == 2) {
			for(int i = 250001 ; i <= 500000 ; i ++) {
				cu.setAge(i);
				cu.setHeight(18.11);
				cu.setAmount(new BigDecimal(3330.12));
				cu.setBirthDay(new Date());
				cu.setEmail("xxx@hubei.com");
				cu.setName("小明");
				cu.setSeatPhoneNumber("07558978009");
				cu.setAddress("深圳市龙华新区街道办");
				cu.setCardNo("897777");
				cu.setTelephoneNumber("13913910989");
				cusList.add(cu);
			}
		}else if(currentLoopIndex == 3) {
			for(int i = 500001 ; i <= 750000 ; i ++) {
				cu.setAge(i);
				cu.setHeight(18.11);
				cu.setAmount(new BigDecimal(3330.12));
				cu.setBirthDay(new Date());
				cu.setEmail("xxx@hubei.com");
				cu.setName("小明");
				cu.setSeatPhoneNumber("07558978009");
				cu.setAddress("深圳市龙华新区街道办");
				cu.setCardNo("897777");
				cu.setTelephoneNumber("13913910989");
				cusList.add(cu);
			}
		}else if(currentLoopIndex == 4) {
			for(int i = 750001 ; i <= 1000000 ; i ++) {
				cu.setAge(i);
				cu.setHeight(18.11);
				cu.setAmount(new BigDecimal(3330.12));
				cu.setBirthDay(new Date());
				cu.setEmail("xxx@hubei.com");
				cu.setName("小明");
				cu.setSeatPhoneNumber("07558978009");
				cu.setAddress("深圳市龙华新区街道办");
				cu.setCardNo("897777");
				cu.setTelephoneNumber("13913910989");
				cusList.add(cu);
			}
		}
		return cusList;
	}

	@Override
	public String writePath() {
		return "src/test/resources/excel-write2222.xlsx";
	}
	
	

}
